/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.netbeans.saas.twitter;

import java.io.*;
import java.net.*;

import javax.servlet.*;
import javax.servlet.http.*;

/**
 *
 * @author balbir kaur
 */
public class TwitterWhatAreYouDoingServiceLogin extends HttpServlet {
   
    private static String CLASS_NAME = TwitterWhatAreYouDoingServiceLogin.class.getSimpleName();
    private static String CALLBACK_URL = CLASS_NAME.replace("Login", "Callback");
    
    
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {     
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Twitter authorization page </title>");
            out.println("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
            out.println("<link href='include/quiz.css' rel='stylesheet' media='screen' type='text/css'/>");
            out.println("</head>");
            out.println("<body>");
            out.println("<div id='header'>");
            out.println("<h2><em>Counter Strike 1.6 Quiz</em></h2><br/>");
            out.println("<em>How well do you know cs1.6 </em>");
            out.println("</div>");
            out.println("<div id='allcontent'>");
            out.println("<div id='leftsidebar'>");
            out.println("#Development of OAuth authentication is pending");
            out.println("after which you will not be required to login on this");
            out.println("site and can login directly with the twiiter site");
            out.println("</div>");
            out.println("<div id='main'>");
            out.println("<p class='notice'>We do not store your username or password information</p><br/>");
            out.println("<form method=\"post\" action=\"./" + CALLBACK_URL + "\">");
            out.println("<br><br><br>");
            out.println("<table cellspacing=0 cellpadding=0 width=320 align=\"center\">");
            out.println("<tr><td><p class='notice'><strong>Username:</strong></p></td><td>");
            out.println("<tr><td><input name=\"username\" type=\"text\" width=10></td></tr>");
            out.println("<tr><td><p class='notice'><strong>Password:</strong></p></td><td>");
            out.println("<tr><td><input name=\"password\" type=\"password\" width=10></td></tr><br/>");
            out.println("<tr><td colspan=2 align=\"center\"><input name=\"login\" type=\"submit\" value=\"Login!\"></td></tr>");
            out.println("</table>");
            out.println("</form>");
            
        } finally { 
            out.println("</div>");
            out.println("</div>");
            out.print("<div id='footer'>");
            out.println("<div align='right'>mail to:<a href='mailto:ramannanda9@gmail.com'><em> ramannanda9@gmail.com</em></a><br/>");
            out.println("<em>&copy;CS-QUIZ</em> developed by <em>Raman deep Singh</em><br/>CS-QUIZ Web App is powered by &dagger;<em>Struts2</em> Framework </div></div>");
            out.println("</body>");
            out.println("</html>");
            out.close();
        }
    } 

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /** 
    * Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    */
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    } 

    /** 
    * Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    */
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    }

    /** 
    * Returns a short description of the servlet.
    */
    public String getServletInfo() {
        return "Short description";
    }
    // </editor-fold>
}